// [869]重新排序得到 2 的幂
struct Solution;

//leetcode submit region begin(Prohibit modification and deletion)
impl Solution {
    pub fn reordered_power_of2(n: i32) -> bool {
        let mut chars = n.to_string().chars().collect::<Vec<char>>();
        chars.sort();
        for i in 0..32 {
            let mut temp = 2u32.pow(i).to_string().chars().collect::<Vec<char>>();
            temp.sort();
            if temp == chars {
                return true;
            }
        }
        false
    }
}
//leetcode submit region end(Prohibit modification and deletion)


#[test]
fn main() {
    assert_eq!(Solution::reordered_power_of2(1), true);
    assert_eq!(Solution::reordered_power_of2(10), false);
}